<template>
  <div>
    <!-- 操作信息 -->
    <div class="actionInfo bb boxItem">
      <h4 class="withVerticleLineT4 title14">{{ $t('operationInfo') }}</h4>
      <div class="descBox">
        <div class="descColHalf">
          <div class="descItem">
            <span class="descTitle">{{ $t('applicant') }}</span>
            <span class="descValue">
              <table-ellipsis :tableEllipsisIsTurnLine="false" :text="info.createBy || '-'"></table-ellipsis>
            </span>
          </div>
        </div>
        <div class="descColHalf">
          <div class="descItem">
            <span class="descTitle">{{ $t('applicationTime') }}</span>
            <span class="descValue">
              <table-ellipsis
                :tableEllipsisIsTurnLine="false"
                :text="$commonFun.getDateTimeStr(info.createTime)"
              ></table-ellipsis>
            </span>
          </div>
        </div>
      </div>
      <div class="descBox">
        <div class="descColFull">
          <div class="descItem">
            <span class="descTitle">{{ $t('remark') }}</span>
            <span class="descValue">{{ info.remark || '-' }}</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 基本信息 -->
    <div class="baseInfo bb boxItem">
      <h4 class="withVerticleLineT4 title14">{{ $t('basicInformation') }}</h4>
      <div class="descItem">
        <span class="descTitle">{{ $t('sjcl') }}</span>
        <span class="descValue">
          <a @click="lookupSjcl(info.relId, 1)">
            <table-ellipsis :tableEllipsisIsTurnLine="false" :text="info.relName || '-'"></table-ellipsis>
          </a>
        </span>
      </div>
    </div>
    <!-- 审核项是策略时测试结果start -->
    <div class="baseInfo bb boxItem">
      <h4 class="withVerticleLineT4 title14">{{ $t('testResult') }}</h4>
      <div class="descBox">
        <div class="descCol1">
          <!-- 全部车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('allVehicles') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis :tableEllipsisIsTurnLine="false" :text="linkedInfo.totalVehicle || '-'"></table-ellipsis>
            </span>
          </div>
          <!-- 进行中车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('vehicleInProgress') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis
                :tableEllipsisIsTurnLine="false"
                :text="linkedInfo.runningVehicle || '-'"
              ></table-ellipsis>
            </span>
          </div>
          <!-- 未完成车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('unfinishedVehicle') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis
                :tableEllipsisIsTurnLine="false"
                :text="linkedInfo.notCompleteVehicle || '-'"
              ></table-ellipsis>
            </span>
          </div>
        </div>
        <div class="descCol2">
          <!-- 成功车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('successfulVehicle') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis
                :tableEllipsisIsTurnLine="false"
                :text="linkedInfo.successVehicle || '-'"
              ></table-ellipsis>
            </span>
          </div>
          <!-- 未开始车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('vehicleNotStarted') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis
                :tableEllipsisIsTurnLine="false"
                :text="linkedInfo.notStartVehicle || '-'"
              ></table-ellipsis>
            </span>
          </div>
        </div>
        <div class="descCol3">
          <!-- 失败车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('failedVehicle') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis :tableEllipsisIsTurnLine="false" :text="linkedInfo.failVehicle || '-'"></table-ellipsis>
            </span>
          </div>
          <!-- 已暂停车辆(台) -->
          <div class="descItem">
            <span class="descTitle">{{ $t('suspendedVehicle') }}({{ $t('tai') }})</span>
            <span class="descValue">
              <table-ellipsis :tableEllipsisIsTurnLine="false" :text="linkedInfo.pausedVehicle || '-'"></table-ellipsis>
            </span>
          </div>
        </div>
      </div>
      <!-- 审核项是策略时测试结果end -->
      <!-- 查看策略详情 -->
      <show-strategy-info ref="showStrategy" :updata-strategy-id="strategyId" :strategy-type="strategyType">
      </show-strategy-info>
    </div>
  </div>
</template>
<script>
import TableEllipsis from '@/components/Ellipsis/TableEllipsis'
import ShowStrategyInfo from '@/views/components/ShowConditionUpdateStrategy'
export default {
  components: {
    TableEllipsis,
    ShowStrategyInfo
  },
  props: {
    info: {
      type: Object,
      default () {
        return {}
      }
    },
    linkedInfo: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    return {
      strategyId: '',
      strategyType: 'Fota'
    }
  },
  methods: {
    // 查看升级策略
    lookupSjcl (strategyId, type) {
      this.strategyId = strategyId
      this.strategyType = type === 2 ? 'Sota' : 'Fota'
      if (this.strategyId) {
        this.$refs.showStrategy.visible = true
      }
    }
  }
}
</script>
